#ifndef KERNELS_H_
#define KERNELS_H_

#include "Dictionary.h"
#include <cmath>
#include <ctime>
#include <algorithm>
#include <thrust/reduce.h>

#define CUDA_RAND_MAX 4294967295

#define BLOCK_SIZE  500000

/*-----------------------------------------------------------------------------
 *  Compara duas palavras
 *-----------------------------------------------------------------------------*/
__host__ __device__ int wordCompare(Word w1, Word w2);

/*-----------------------------------------------------------------------------
 *  Calcula a probabilidade acumulada
 *-----------------------------------------------------------------------------*/
void getWordProb(HostProb &accProb, uint maxSize);

/*-----------------------------------------------------------------------------
 *  Verifica a quantidade de acertos em um bloco de palavras
 *-----------------------------------------------------------------------------*/
int seqCountHits(HostWordPair &hostDict, uint* hostHits, HostProb &hostProb);

/*-----------------------------------------------------------------------------
 *  Chama a inicilização dos estados CURAND
 *-----------------------------------------------------------------------------*/
void callSetupKernel(uint blocks, uint threads, DevState &state);

/*-----------------------------------------------------------------------------
 *  Chama a geração de palavras CUDA
 *-----------------------------------------------------------------------------*/
int callCountHits(uint blocks, uint threads, DevWordPair &devDict, DevHits &devHits,
        DevProb &devProb, DevState &devState);

#endif /* KERNELS_H_ */
